package edu.unf.cen6940.domain;

import java.io.Serializable;

import java.lang.StringBuilder;

import java.util.LinkedHashSet;
import java.util.Set;

import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;

import javax.xml.bind.annotation.*;

import javax.persistence.*;

/**
 */

@Entity
@NamedQueries({
		@NamedQuery(name = "findAllThesiscommittees", query = "select myThesiscommittee from Thesiscommittee myThesiscommittee"),
		@NamedQuery(name = "findThesiscommitteeByPrimaryKey", query = "select myThesiscommittee from Thesiscommittee myThesiscommittee where myThesiscommittee.thesisCommitteeId = ?1"),
		@NamedQuery(name = "findThesiscommitteeByThesisCommitteeId", query = "select myThesiscommittee from Thesiscommittee myThesiscommittee where myThesiscommittee.thesisCommitteeId = ?1") })
@Table(catalog = "ThesisManagement", name = "ThesisCommittee")
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(namespace = "rms_test/edu/unf/cen6940/domain", name = "Thesiscommittee")
public class Thesiscommittee implements Serializable {
	private static final long serialVersionUID = 1L;

	/**
	 */

	@Column(name = "thesisCommitteeID", nullable = false)
	@GeneratedValue(strategy=GenerationType.IDENTITY)
	@Basic(fetch = FetchType.EAGER)
	@Id
	@XmlElement
	Integer thesisCommitteeId;

	/**
	 */
	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumns({ @JoinColumn(name = "committeeMember1", referencedColumnName = "facultyID") })
	@XmlTransient
	Faculty facultyByCommitteeMember1;
	/**
	 */
	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumns({ @JoinColumn(name = "chair", referencedColumnName = "facultyID", nullable = false) })
	@XmlTransient
	Faculty facultyByChair;
	/**
	 */
	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumns({ @JoinColumn(name = "committeeMember2", referencedColumnName = "facultyID") })
	@XmlTransient
	Faculty facultyByCommitteeMember2;
	/**
	 */
	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumns({ @JoinColumn(name = "committeeMember3", referencedColumnName = "facultyID") })
	@XmlTransient
	Faculty facultyByCommitteeMember3;
	/**
	 */
	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumns({ @JoinColumn(name = "committeeMember4", referencedColumnName = "facultyID") })
	@XmlTransient
	Faculty facultyByCommitteeMember4;
	/**
	 */
	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumns({ @JoinColumn(name = "committeeMember5", referencedColumnName = "facultyID") })
	@XmlTransient
	Faculty facultyByCommitteeMember5;
	/**
	 */
	@ManyToMany(mappedBy = "thesiscommittees", fetch = FetchType.LAZY)
	@XmlElement(name = "", namespace = "")
	java.util.Set<edu.unf.cen6940.domain.Thesis> thesises;

	/**
	 */
	public void setThesisCommitteeId(Integer thesisCommitteeId) {
		this.thesisCommitteeId = thesisCommitteeId;
	}

	/**
	 */
	public Integer getThesisCommitteeId() {
		return this.thesisCommitteeId;
	}

	/**
	 */
	public void setFacultyByCommitteeMember1(Faculty facultyByCommitteeMember1) {
		this.facultyByCommitteeMember1 = facultyByCommitteeMember1;
	}

	/**
	 */
	public Faculty getFacultyByCommitteeMember1() {
		return facultyByCommitteeMember1;
	}

	/**
	 */
	public void setFacultyByChair(Faculty facultyByChair) {
		this.facultyByChair = facultyByChair;
	}

	/**
	 */
	public Faculty getFacultyByChair() {
		return facultyByChair;
	}

	/**
	 */
	public void setFacultyByCommitteeMember2(Faculty facultyByCommitteeMember2) {
		this.facultyByCommitteeMember2 = facultyByCommitteeMember2;
	}

	/**
	 */
	public Faculty getFacultyByCommitteeMember2() {
		return facultyByCommitteeMember2;
	}

	/**
	 */
	public void setFacultyByCommitteeMember3(Faculty facultyByCommitteeMember3) {
		this.facultyByCommitteeMember3 = facultyByCommitteeMember3;
	}

	/**
	 */
	public Faculty getFacultyByCommitteeMember3() {
		return facultyByCommitteeMember3;
	}

	/**
	 */
	public void setFacultyByCommitteeMember4(Faculty facultyByCommitteeMember4) {
		this.facultyByCommitteeMember4 = facultyByCommitteeMember4;
	}

	/**
	 */
	public Faculty getFacultyByCommitteeMember4() {
		return facultyByCommitteeMember4;
	}

	/**
	 */
	public void setFacultyByCommitteeMember5(Faculty facultyByCommitteeMember5) {
		this.facultyByCommitteeMember5 = facultyByCommitteeMember5;
	}

	/**
	 */
	public Faculty getFacultyByCommitteeMember5() {
		return facultyByCommitteeMember5;
	}

	/**
	 */
	public void setThesises(Set<Thesis> thesises) {
		this.thesises = thesises;
	}

	/**
	 */
	public Set<Thesis> getThesises() {
		if (thesises == null) {
			thesises = new java.util.LinkedHashSet<edu.unf.cen6940.domain.Thesis>();
		}
		return thesises;
	}

	/**
	 */
	public Thesiscommittee() {
	}

	/**
	 * Copies the contents of the specified bean into this bean.
	 *
	 */
	public void copy(Thesiscommittee that) {
		setThesisCommitteeId(that.getThesisCommitteeId());
		setFacultyByCommitteeMember1(that.getFacultyByCommitteeMember1());
		setFacultyByChair(that.getFacultyByChair());
		setFacultyByCommitteeMember2(that.getFacultyByCommitteeMember2());
		setFacultyByCommitteeMember3(that.getFacultyByCommitteeMember3());
		setFacultyByCommitteeMember4(that.getFacultyByCommitteeMember4());
		setFacultyByCommitteeMember5(that.getFacultyByCommitteeMember5());
		setThesises(new java.util.LinkedHashSet<edu.unf.cen6940.domain.Thesis>(that.getThesises()));
	}

	/**
	 * Returns a textual representation of a bean.
	 *
	 */
	public String toString() {

		StringBuilder buffer = new StringBuilder();

		buffer.append("thesisCommitteeId=[").append(thesisCommitteeId).append("] ");

		return buffer.toString();
	}

	/**
	 */
	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = (int) (prime * result + ((thesisCommitteeId == null) ? 0 : thesisCommitteeId.hashCode()));
		return result;
	}

	/**
	 */
	public boolean equals(Object obj) {
		if (obj == this)
			return true;
		if (!(obj instanceof Thesiscommittee))
			return false;
		Thesiscommittee equalCheck = (Thesiscommittee) obj;
		if ((thesisCommitteeId == null && equalCheck.thesisCommitteeId != null) || (thesisCommitteeId != null && equalCheck.thesisCommitteeId == null))
			return false;
		if (thesisCommitteeId != null && !thesisCommitteeId.equals(equalCheck.thesisCommitteeId))
			return false;
		return true;
	}
}
